SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].FacturasPagosDeleteCommand
(
	@Original_ID numeric(10, 0),
	@Original_ID_FACTURA numeric(10, 0),
	@Original_ID_TIPO numeric(10, 0),
	@Original_ID_BANCO numeric(10, 0),
	@Original_ID_USUARIO numeric(10, 0),
	@IsNull_NRO_DOCUMENTO Int,
	@Original_NRO_DOCUMENTO varchar(50),
	@IsNull_PORTADOR Int,
	@Original_PORTADOR varchar(70),
	@IsNull_TELEFONO Int,
	@Original_TELEFONO varchar(14),
	@Original_FECHA datetime2,
	@Original_MONTO numeric(10, 2)
)
AS
	SET NOCOUNT OFF;
DELETE FROM [FACTURAS_PAGOS] WHERE (([ID] = @Original_ID) AND ([ID_FACTURA] = @Original_ID_FACTURA) AND ([ID_TIPO] = @Original_ID_TIPO) AND ([ID_BANCO] = @Original_ID_BANCO) AND ([ID_USUARIO] = @Original_ID_USUARIO) AND ((@IsNull_NRO_DOCUMENTO = 1 AND [NRO_DOCUMENTO] IS NULL) OR ([NRO_DOCUMENTO] = @Original_NRO_DOCUMENTO)) AND ((@IsNull_PORTADOR = 1 AND [PORTADOR] IS NULL) OR ([PORTADOR] = @Original_PORTADOR)) AND ((@IsNull_TELEFONO = 1 AND [TELEFONO] IS NULL) OR ([TELEFONO] = @Original_TELEFONO)) AND ([FECHA] = @Original_FECHA) AND ([MONTO] = @Original_MONTO))
GO
